#include "../inc/graph.h"

extern "C" {
GraphC *createGraph(int numNodes,int numEdges){

  GraphC *g;

  g=(GraphC *) malloc(sizeof(GraphC));
  if(g == NULL)
  {
    printf("Not enough memory to allocate graph\n");
    exit(EXIT_MEMORY);
  }

  g->numNodes = numNodes;
  g->numEdges = numEdges;
  g->nodesList = (NodesList *) createNodesList();

  return g;
}

void initNodes(int numNodes,GraphC *g)
{
  int i;

  for(i=1;i<numNodes+1;i++)
  {
    Node *n = (Node *) createNode(i);
    appendNodesList(n,g->nodesList);
  }
}

void destructGraph(GraphC* g)
{
    destroyNodesList(&g->nodesList);
    free(g);
}

}
